PYTHONPATH := ../migen:../misoc
export PYTHONPATH
OVCTL := ../../host/ovctl.py
BUILD := build
TOP := ov3
BITFILE := $(BUILD)/$(TOP).bit
FWPKG := $(BUILD)/$(TOP).fwpkg

PYTHON := python3

PY_FILES := $(shell find ovhw ovplatform -name '*.py')

all: $(BITFILE) $(FWPKG)

$(FWPKG): $(BITFILE)
	$(PYTHON) -m zipfile -c $@ $< $(BUILD)/map.txt

$(BITFILE): $(PY_FILES)
	$(PYTHON) build.py -d $(BUILD) -n $(TOP)

clean:
	rm -rf $(BUILD)/*

# Full test of tests anywhere in source tree, including basic sanity 
# tests on per-module basis
testall:
	nosetests3 --all-modules -v

# Just the explicit testsuite
test:
	nosetests3 sim -v

run: $(OVCTL) $(BITFILE)
	$(OVCTL) -C -b $(BITFILE) none
